package com.yhf.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yhf.dto.BranchDto;
import com.yhf.dto.ItemDto;
import com.yhf.dto.SubitemDto;
import com.yhf.dto.TaskPlanDto;
import com.yhf.model.Item;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

@Mapper
public interface ItemMapper extends BaseMapper<Item> {
    @Results(id = "ITEM",value = {
            @Result(column = "iid",property = "iid"),
            @Result(column = "iname",property = "iname"),
            @Result(column = "starttime",property = "starttime"),
            @Result(column = "endtime",property = "endtime"),
            @Result(column = "updatetime",property = "updatetime"),
            @Result(column = "status",property = "status"),
            @Result(column = "suid",property = "subitemDto",javaType = SubitemDto.class,one =
            @One(select = "com.yhf.mapper.SubitemMapper.selectBySuId",fetchType = FetchType.EAGER))
    })
    @Select("select * from item ${ew.customSqlSegment}")
    IPage<ItemDto> selectAll(Page<ItemDto> page, @Param(Constants.WRAPPER) QueryWrapper<ItemDto> queryWrapper);

}
